const a='1231232132132132131'
const b='123213213213123213'
function add(n,m){
    let i=n.length-1
    let j=m.length-1
    let carry=0
    let result=[]
    while(i>=0||j>=0||carry>0){
        const digit1=i>=0?parseInt(n[i]):0
        const digit2=j>=0?parseInt(m[j]):0
        const sum=digit1+digit2+carry
        carry=Math.floor(sum/10)
        result.unshift(sum%10)
        j--
        i--
    }
    return result.join('')
}
console.log(add(a,b))
